package cn.javase.io_model.bio._04_基于BIO形式下的文件上传;

import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.net.InetAddress;
import java.net.Socket;

public class Client {
    public static void main(String[] args) {
        try(
            Socket socket = new Socket(InetAddress.getLocalHost(), 8888);
            DataOutputStream dos = new DataOutputStream(socket.getOutputStream());
            FileInputStream is = new FileInputStream("")

        ) {
            dos.writeUTF(".png");
            byte[] bytes = new byte[1024];
            int len;
            while ((len = is.read(bytes)) != -1) {
                dos.write(bytes, 0, len);
            }
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
    }
}
